//
//  TranstionTableViewCell.m
//  Shengzhuli
//
//  Created by 卡忙科技 on 16/8/22.
//  Copyright © 2016年 kamangkeji. All rights reserved.
//

#import "TranstionTableViewCell.h"
#import <UIImageView+WebCache.h>

@interface TranstionTableViewCell()

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UILabel *priceLab;
@property (weak, nonatomic) IBOutlet UILabel *amountLab;
@property (weak, nonatomic) IBOutlet UILabel *daysLab;
@property (weak, nonatomic) IBOutlet UILabel *alreadySellLab;


@end

@implementation TranstionTableViewCell

- (void)setModel:(TranstionModel *)model
{
    _model = model;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.thumbnailUrl] placeholderImage:GetImage(@"default_goods_image")];
    self.nameLab.text = model.productName;
    self.priceLab.text = [NSString stringWithFormat:@"价格:¥%.2f",model.price];
    self.amountLab.text = [NSString stringWithFormat:@"库存量:%zd",model.residualStock];
    if (model.type == FutureTypeNormal) {
        self.alreadySellLab.hidden = NO;
        self.alreadySellLab.text = [NSString stringWithFormat:@"已售:%zd",model.alreadySoldCount];
        self.daysLab.text = [NSString stringWithFormat:@"共%zd天",model.stageCount];
        self.amountLab.text = [NSString stringWithFormat:@"库存量:%zd",model.residualStock];
    }else{
        self.alreadySellLab.hidden = YES;
        self.daysLab.text = [NSString stringWithFormat:@"剩%zd天",model.surplusDays];
        self.amountLab.text = [NSString stringWithFormat:@"份数:%zd",model.productCount ];
    }
}

@end
